<?php echo $header; ?>
<div id="content">
    <div class="breadcrumb">
        <?php foreach ($breadcrumbs as $breadcrumb) { ?>
        	<?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
        <?php } ?>
    </div>
    
    <?php if ($error_warning) { ?>
    	<div class="warning"><?php echo $error_warning; ?></div>
    <?php } ?>
  
	<div class="box">
        <div class="heading">
        	<h1><img src="view/image/module.png" alt="" /> <?php echo $heading_title; ?></h1>
            <div class="buttons"><a onclick="$('#form').submit();" class="button"><?php echo $button_save; ?></a><a onclick="location = '<?php echo $cancel; ?>';" class="button"><?php echo $button_cancel; ?></a></div>
        </div>
    	<div class="content">
        	<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
                <table class="form">
                    <tr>
                        <td><?php echo $entry_status;?>:</td>
                        <td>
                            <select name="status">
                                <option value="0"<?php if($status == 0){ ?> selected="selected"<?php } ?>><?php echo $text_disabled;?></option>
                                <option value="1"<?php if($status == 1){ ?> selected="selected"<?php } ?>><?php echo $text_enabled;?></option>
                            </select>
                        </td>
                    </tr>
                </table>
                <div id="tabs" class="htabs">
                    <a href="#tab-contactus"><?php echo $text_contact_us;?></a>
                    <a href="#tab-aboutus"><?php echo $text_about_us;?></a>
                    <a href="#tab-news"><?php echo $text_news;?></a>
                    <a href="#tab-twitter"><?php echo $text_twitter;?></a>
                    <a href="#tab-social"><?php echo $text_social;?></a>
                </div>
                <div id="tab-contactus">
                	<table class="form">
                        <tr>
                            <td><?php echo $entry_status;?>:</td>
                            <td>
                                <select name="rcf_contact_us[status]">
                                	<option value="0"<?php if($rcf_contact_us['status'] == 0){ ?> selected="selected"<?php } ?>><?php echo $text_disabled;?></option>
                                    <option value="1"<?php if($rcf_contact_us['status'] == 1){ ?> selected="selected"<?php } ?>><?php echo $text_enabled;?></option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                        	<td><?php echo $entry_header;?>:</td>
                            <td>
                            	<?php foreach ($languages as $language) { ?>
                            		<input type="text" name="rcf_contact_us[header][<?php echo $language['language_id']; ?>]"
                                    	value="<?php echo (isset($rcf_contact_us['header'][$language['language_id']])) ? $rcf_contact_us['header'][$language['language_id']] : '';?>" size="40" />
                                   	<img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
                                <?php } ?>
                            </td>
                        </tr>
                        <tr>
                        	<td><?php echo $entry_phone;?>:</td>
                            <td>
                            	<?php foreach ($languages as $language) { ?>
                            		<input type="text" name="rcf_contact_us[phone][<?php echo $language['language_id']; ?>]"
                                    	value="<?php echo (isset($rcf_contact_us['phone'][$language['language_id']])) ? $rcf_contact_us['phone'][$language['language_id']] : '';?>" size="40" />
                                   	<img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
                                <?php } ?>
                            </td>
                        </tr>
                        <tr>
                        	<td><?php echo $entry_fax;?>:</td>
                            <td>
                            	<?php foreach ($languages as $language) { ?>
                            		<input type="text" name="rcf_contact_us[fax][<?php echo $language['language_id']; ?>]"
                                    	value="<?php echo (isset($rcf_contact_us['fax'][$language['language_id']])) ? $rcf_contact_us['fax'][$language['language_id']] : '';?>" size="40" />
                                   	<img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
                                <?php } ?>
                            </td>
                        </tr>
                        <tr>
                        	<td><?php echo $entry_email;?>:</td>
                            <td>
                            	<?php foreach ($languages as $language) { ?>
                            		<input type="text" name="rcf_contact_us[email][<?php echo $language['language_id']; ?>]"
                                    	value="<?php echo (isset($rcf_contact_us['email'][$language['language_id']])) ? $rcf_contact_us['email'][$language['language_id']] : '';?>" size="40" />
                                   	<img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
                                <?php } ?>
                            </td>
                        </tr>
                        <tr>
                        	<td><?php echo $entry_address;?>:</td>
                            <td>
                            	<?php foreach ($languages as $language) { ?>
                            		<input type="text" name="rcf_contact_us[address][<?php echo $language['language_id']; ?>]"
                                    	value="<?php echo (isset($rcf_contact_us['address'][$language['language_id']])) ? $rcf_contact_us['address'][$language['language_id']] : '';?>" size="40" />
                                   	<img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
                                <?php } ?>
                            </td>
                        </tr>
                        <tr>
                        	<td><?php echo $entry_skype;?>:</td>
                            <td>
                            	<?php foreach ($languages as $language) { ?>
                            		<input type="text" name="rcf_contact_us[skype][<?php echo $language['language_id']; ?>]"
                                    	value="<?php echo (isset($rcf_contact_us['skype'][$language['language_id']])) ? $rcf_contact_us['skype'][$language['language_id']] : '';?>" size="40" />
                                   	<img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
                                <?php } ?>
                            </td>
                        </tr>
                    </table>
                </div>
                <div id="tab-aboutus">
                	<table class="form">
                        <tr>
                            <td><?php echo $entry_status;?>:</td>
                            <td>
                                <select name="rcf_about_us[status]">
                                	<option value="0"<?php if($rcf_about_us['status'] == 0){ ?> selected="selected"<?php } ?>><?php echo $text_disabled;?></option>
                                    <option value="1"<?php if($rcf_about_us['status'] == 1){ ?> selected="selected"<?php } ?>><?php echo $text_enabled;?></option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_content;?>:</td>
                            <td>
                            	<div id="tabs-aboutus" class="htabs">
                                	<?php foreach ($languages as $language) { ?>
                                    	<a href="#tab-aboutus-<?php echo $language['language_id']; ?>"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /></a>
                                    <?php } ?>
                                </div>
                                <?php foreach ($languages as $language) { ?>
                                	<div id="tab-aboutus-<?php echo $language['language_id']; ?>">
                            			<textarea id="tab-aboutus-textarea-<?php echo $language['language_id']; ?>" name="rcf_about_us[content][<?php echo $language['language_id']; ?>]" cols="100" rows="15"><?php echo isset($rcf_about_us['content'][$language['language_id']]) ? $rcf_about_us['content'][$language['language_id']] : ''; ?></textarea>
                                    </div>
                                <?php } ?>
                            </td>
                        </tr>
                    </table>
                </div>
                <div id="tab-news">
                	<table class="form">
                        <tr>
                            <td><?php echo $entry_status;?>:</td>
                            <td>
                                <select name="rcf_news[status]">
                                	<option value="0"<?php if($rcf_news['status'] == 0){ ?> selected="selected"<?php } ?>><?php echo $text_disabled;?></option>
                                    <option value="1"<?php if($rcf_news['status'] == 1){ ?> selected="selected"<?php } ?>><?php echo $text_enabled;?></option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <table id="news" class="list">
                                    <thead>
                                        <tr>
                                            <td class="left"><?php echo $entry_image;?>:</td>
                                            <td class="left"><?php echo $entry_date;?>:</td>
                                            <td class="left"><?php echo $entry_title;?>:</td>
                                            <td class="left"><?php echo $entry_link;?>:</td>
                                            <td class="left"><?php echo $entry_sort;?>:</td>
                                            <td class="left"><?php echo $entry_status;?>:</td>
                                            <td></td>
                                        </tr>
                                    </thead>
                                    <tfoot>
                                    	<tr>
                                        	<td colspan="6"></td>
                                            <td class="left"><a onclick="addNews();" class="button"><?php echo $text_addnews;?></a></td>
                                        </tr>
                                    </tfoot>
                                    <tbody>
                                    	<?php $news_row = 0; ?>
          								<?php foreach ($rcf_news['rows'] as $news) { ?>
                                        <tr id="news-row<?php echo $news_row; ?>">
                                            <td class="left">
                                            	<input type="hidden" name="rcf_news[rows][<?php echo $news_row; ?>][image]" value="<?php echo $news['image']; ?>" id="image<?php echo $news_row; ?>">
                                                <img src="<?php echo $news['thumb']; ?>" alt="" id="thumb<?php echo $news_row; ?>" style="float: left; margin: 0 10px 0 0;">

                                                <a onclick="image_upload('image<?php echo $news_row; ?>', 'thumb<?php echo $news_row; ?>');"><?php echo $text_browse;?></a><br><br>
                                                <a onclick="$('#thumb<?php echo $news_row; ?>').attr('src', '<?php echo $img_no_image; ?>'); $('#image<?php echo $news_row; ?>').attr('value', '');"><?php echo $text_clear;?></a>
                                            </td>
                                            <td class="left"><input type="text" name="rcf_news[rows][<?php echo $news_row; ?>][date]" class="date" value="<?php echo $news['date']; ?>" size="12"></td>
                                            <td class="left">
                                            	<?php foreach ($languages as $language) { ?>
                                                    <input type="text" size="30"
                                                    	name="rcf_news[rows][<?php echo $news_row; ?>][title][<?php echo $language['language_id']; ?>]"
                                                        value="<?php echo $news['title'][$language['language_id']]; ?>" />
                                                    <img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />
                                                <?php } ?>
                                            </td>
                                            <td class="left"><textarea name="rcf_news[rows][<?php echo $news_row; ?>][link]" cols="30" rows="3"><?php echo $news['link']; ?></textarea></td>
                                            <td class="left"><input type="text" name="rcf_news[rows][<?php echo $news_row; ?>][sort]" value="<?php echo $news['sort']; ?>" size="2"></td>
                                            <td class="left">
                                            	<select name="rcf_news[rows][<?php echo $news_row; ?>][status]">
                                                    <option value="0"<?php if($news['status'] == 0){ ?> selected="selected"<?php } ?>><?php echo $text_disabled;?></option>
                                                    <option value="1"<?php if($news['status'] == 1){ ?> selected="selected"<?php } ?>><?php echo $text_enabled;?></option>
                                                </select>
                                            </td>
                                            <td class="left"><a onclick="$('#news-row<?php echo $news_row; ?>').remove();" class="button"><?php echo $text_remove;?></a></td>
                                        </tr>
                                        <?php $news_row++; ?>
          								<?php } ?>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                    </table>
                </div>
                <div id="tab-twitter">
                	<table class="form">
                        <tr>
                            <td><?php echo $entry_status;?>:</td>
                            <td>
                                <select name="rcf_twitter[status]">
                                	<option value="0"<?php if($rcf_twitter['status'] == 0){ ?> selected="selected"<?php } ?>><?php echo $text_disabled;?></option>
                                    <option value="1"<?php if($rcf_twitter['status'] == 1){ ?> selected="selected"<?php } ?>><?php echo $text_enabled;?></option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_username;?>:</td>
                            <td><input type="text" name="rcf_twitter[username]" value="<?php echo $rcf_twitter['username']; ?>" size="40" /></td>
                        </tr>
                        <tr>
                        	<td><?php echo $entry_count;?>:</td>
                            <td>
                                <select name="rcf_twitter[count]">
                                	<option value="1"<?php if($rcf_twitter['count'] == 1){ ?> selected="selected"<?php } ?>>1</option>
                                    <option value="2"<?php if($rcf_twitter['count'] == 2){ ?> selected="selected"<?php } ?>>2</option>
                                    <option value="3"<?php if($rcf_twitter['count'] == 3){ ?> selected="selected"<?php } ?>>3</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td><?php echo $entry_interval;?>:<br /><span class="help"><?php echo $entry_interval_help;?></span></td>
                            <td><input type="text" name="rcf_twitter[interval]" value="<?php echo $rcf_twitter['interval']; ?>" size="10" /></td>
                        </tr>
                    </table>
                </div>
                <div id="tab-social">
                	<table class="form">
                        <tr>
                            <td><?php echo $entry_status;?>:</td>
                            <td>
                                <select name="rcf_social[status]">
                                	<option value="0"<?php if($rcf_social['status'] == 0){ ?> selected="selected"<?php } ?>><?php echo $text_disabled;?></option>
                                    <option value="1"<?php if($rcf_social['status'] == 1){ ?> selected="selected"<?php } ?>><?php echo $text_enabled;?></option>
                                </select>
                            </td>
                        </tr>
                        <tr><td>Facebook:</td><td><input type="text" name="rcf_social[facebook]" value="<?php echo $rcf_social['facebook']; ?>" size="60" /></td></tr>
                        <tr><td>Twitter:</td><td><input type="text" name="rcf_social[twitter]" value="<?php echo $rcf_social['twitter']; ?>" size="60" /></td></tr>
                        <tr><td>RSS:</td><td><input type="text" name="rcf_social[rss]" value="<?php echo $rcf_social['rss']; ?>" size="60" /></td></tr>
                        <tr><td>Dribbble:</td><td><input type="text" name="rcf_social[dribbble]" value="<?php echo $rcf_social['dribbble']; ?>" size="60" /></td></tr>
                        <tr><td>Forrst:</td><td><input type="text" name="rcf_social[forrst]" value="<?php echo $rcf_social['forrst']; ?>" size="60" /></td></tr>
                        <tr><td>Vimeo:</td><td><input type="text" name="rcf_social[vimeo]" value="<?php echo $rcf_social['vimeo']; ?>" size="60" /></td></tr>
                        <tr><td>Linked In:</td><td><input type="text" name="rcf_social[linkedin]" value="<?php echo $rcf_social['linkedin']; ?>" size="60" /></td></tr>
                    </table>
                </div>
            </form>
    	</div>
    </div>
</div>
<script type="text/javascript" src="view/javascript/ckeditor/ckeditor.js"></script> 
<script type="text/javascript"><!--
	<?php foreach ($languages as $language) { ?>
		CKEDITOR.replace('tab-aboutus-textarea-<?php echo $language['language_id']; ?>', {
			filebrowserBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
			filebrowserImageBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
			filebrowserFlashBrowseUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
			filebrowserUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
			filebrowserImageUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>',
			filebrowserFlashUploadUrl: 'index.php?route=common/filemanager&token=<?php echo $token; ?>'
		});
	<?php } ?>
//--></script> 
<script type="text/javascript"><!--
	$('#tabs-aboutus a').tabs();
	$('#tabs a').tabs();
//--></script> 
<script type="text/javascript"><!--
$('.date').datepicker({dateFormat: 'yy-mm-dd'});

var newsRow = <?php echo $news_row; ?>;

function addNews(){
	html =	'<tr id="news-row' + newsRow + '">';
	html +=		'<td class="left">';
	html +=			'<input type="hidden" name="rcf_news[rows][' + newsRow + '][image]" value="" id="image' + newsRow + '">';
	html +=			'<img src="<?php echo $img_no_image; ?>" alt="" id="thumb' + newsRow + '" style="float: left; margin: 0 10px 0 0;">';
	html +=			'<a onclick="image_upload(\'image' + newsRow + '\', \'thumb' + newsRow + '\');"><?php echo $text_browse;?></a><br><br>';
	html +=			'<a onclick="$(\'#thumb' + newsRow + '\').attr(\'src\', \'<?php echo $img_no_image; ?>\'); $(\'#image' + newsRow + '\').attr(\'value\', \'\');"><?php echo $text_clear;?></a>';
	html +=		'</td>';
	html +=		'<td class="left"><input type="text" class="date" name="rcf_news[rows][' + newsRow + '][date]" value="" size="12"></td>';
	html +=		'<td class="left">';
					<?php foreach ($languages as $language) { ?>
	html +=				'<input type="text" size="30" name="rcf_news[rows][' + newsRow + '][title][<?php echo $language['language_id']; ?>]" value="" />';
	html +=				'<img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /><br />';
					<?php } ?>
	html +=		'</td>';
	html +=		'<td class="left"><textarea name="rcf_news[rows][' + newsRow + '][link]" cols="30" rows="3"></textarea></td>';
	html +=		'<td class="left"><input type="text" name="rcf_news[rows][' + newsRow + '][sort]" value="0" size="2"></td>';
	html +=		'<td class="left">';
	html +=			'<select name="rcf_news[rows][' + newsRow + '][status]">';
	html +=				'<option value="0" selected="selected"><?php echo $text_disabled;?></option>';
	html +=				'<option value="1"><?php echo $text_enabled;?></option>';
	html +=			'</select>';
	html +=		'</td>';
	html +=		'<td class="left"><a onclick="$(\'#news-row' + newsRow + '\').remove();" class="button"><?php echo $text_remove;?></a></td>';
	html +=	'</tr>'	;
	
	html = $(html);
	html.find('.date').datepicker({dateFormat: 'yy-mm-dd'});
	
	$('#news tbody').append(html);
	
	newsRow++;
}

function image_upload(field, thumb) {
	$('#dialog').remove();
	
	$('#content').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="index.php?route=common/filemanager&token=<?php echo $token; ?>&field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');
	
	$('#dialog').dialog({
		title: '<?php echo $text_image_manager; ?>',
		close: function (event, ui) {
			if ($('#' + field).attr('value')) {
				$.ajax({
					url: 'index.php?route=common/filemanager/image&token=<?php echo $token; ?>&image=' + encodeURIComponent($('#' + field).attr('value')),
					dataType: 'text',
					success: function(data) {
						$('#' + thumb).attr('src', data);
					}
				});
			}
		},	
		bgiframe: false,
		width: 700,
		height: 400,
		resizable: false,
		modal: false
	});
};
//--></script> 
<?php echo $footer; ?>